package com.sunwayworld.basemodule.rm.materialsecondarylibrary.resource.impl;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.sunwayworld.basemodule.rm.materialsecondarylibrary.resource.LimsMaterialSecondaryInventoryResource;
import com.sunwayworld.basemodule.rm.materialsecondarylibrary.service.LimsMaterialSecondaryInventoryService;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;

@LogModule("材料二级库存")
@RestController
@GikamBean
public class LimsMaterialSecondaryInventoryResourceImpl implements LimsMaterialSecondaryInventoryResource {

    @Autowired
    private LimsMaterialSecondaryInventoryService limsMaterialSecondaryInventoryService;

    @Override
    public LimsMaterialSecondaryInventoryService getService() {
        return limsMaterialSecondaryInventoryService;
    }

    @Log(value = "新增材料二级库存", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Log(value = "材料二级库存盘存", type = LogType.UPDATE)
    @Override
    public JSONObject inventory(RestJsonWrapperBean wrapperBean) {
        return getService().inventory(wrapperBean);
    }

    @Log(value = "材料二级库存出库", type = LogType.UPDATE)
    @Override
    public JSONObject checkout(RestJsonWrapperBean wrapperBean) {
        return getService().checkout(wrapperBean);
    }
}
